extends Node2D
#@onready var tile_map: TileMap = $TileMap
@onready var camera_2d: Camera2D = $Player/Camera2D
@onready var map_layer: TileMapLayer = $Layers/MapLayer

func _ready() -> void:
	var used := map_layer.get_used_rect()
	var tile_size := map_layer.tile_set.tile_size
	#print("used",used)
	#print("tile size",tile_size)
	
	camera_2d.limit_top = used.position.y * tile_size.y
	#print("top:",camera_2d.limit_top)
	camera_2d.limit_right = used.end.x * tile_size.x
	#print("right:",camera_2d.limit_right)
	camera_2d.limit_bottom = used.end.y * tile_size.y
	#print("bottom:",camera_2d.limit_bottom)
	camera_2d.limit_left = used.position.x * tile_size.x
	#print("left:",camera_2d.limit_left)
	#取消自动运镜
	camera_2d.reset_smoothing()
	
